library(sf)
## Linking to GEOS 3.5.1, GDAL 2.1.3, proj.4 4.9.2, lwgeom 2.3.2 r15302
library(raster)
## Loading required package: sp
library(mapview)
## Loading required package: leaflet
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:raster':
## 
##     intersect, select, union
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
data('cookfarm', package = "GSIF")

names(cookfarm)
## [1] "readings"    "profiles"    "bdensity"    "grids"       "weather"    
## [6] "proj4string"
grids <- cookfarm$grids %>% 
  dplyr::select(x, y, DEM, TWI, Cook_fall_ECa, Cook_spr_ECa) %>% 
  rasterFromXYZ(crs = cookfarm$proj4string)

plot(grids)

profiles <- cookfarm$profiles %>% 
  st_as_sf(coords = c('Easting', 'Northing'), crs = cookfarm$proj4string)

plot(profiles)

# Plot points
mapview(profiles)
# Plot grids
mapview(grids)
# Plot both together
mapview(grids) + mapview(profiles)